<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-bind指令</title>
</head>

<body>

    <style>
        img {
            width: 120px;
            height: 120px;
        }

        .NaNs {
            border: 1px red solid;
        }
    </style>

    <script src="../js/vue.js"></script>

    <div id="root">
        <!-- v-bind: 主要用于属性绑定 -->
        <img v-bind:src="imSrc" alt="" :title="美女图片">

        <img :src="imSrc" alt="" :title="imgtitle" :class="{NaNs:isNaN}" @click="toogelood">


    </div>

    <script>
        var root = new Vue({
            el: "#root",
            data: {
                imSrc: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fcf8c33dd-db1f-4ec9-bc4c-054e0a4b6d9a%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695870597&t=2f4cc3e15c5c695185752899fe2df415",
                imgtitle: "美女图片",
                isNaN: false
            },

            methods: {
                toogelood() {
                    //取反 !
                    this.isNaN = !this.isNaN
                }
            }
        }) 
    </script>

</body>

</html>